package com.tencent.wxcloudrun.service.impl;

import com.tencent.wxcloudrun.model.User;
import com.tencent.wxcloudrun.repository.UserRepository;
import com.tencent.wxcloudrun.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * 用户服务实现类
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    @Override
    public Optional<User> findByMobile(String mobile) {
        return userRepository.findByMobile(mobile);
    }

    @Override
    public void register(User user) {
        userRepository.save(user);
    }
}
